package java_test.reflection;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

public class FieldTest {
    public static void main(String[] args) {
        Class clazz = Person1.class;
        Field[] fields = clazz.getFields();
        for (Field f : fields) {
            System.out.println(f);
        }
        System.out.println();
        Field[] declaredFields = clazz.getDeclaredFields();
        for (Field f : declaredFields) {
            System.out.println(f);
        }
        System.out.println();
        for (Field f : declaredFields) {
            System.out.println(Modifier.toString(f.getModifiers()));

            Class type = f.getType();
            System.out.println(type.getName());
        }
    }
}
